#include "profile.h"

Profile::Profile()
{
    isQt=false;
    isAutoRun=false;
    init();
}

void Profile::init()
{
    start="";
    systemStr="";
    qt="";
    autoRun="";
    start.append("#!/bin/sh\n")
            .append("echo \"running /etc/profile\"\n")
            .append("\n");

    systemStr.append("#system\n")
            .append("export HOME=/root\n")
            .append("\n");


    qt.append("#qt\n")
            .append("export TSLIB_ROOT=/usr/qt\n")
            .append("export TSLIB_TSDEVICE=/dev/input/event0\n")
            .append("export TSLIB_CONFFILE=/etc/ts.conf\n")
            .append("export TSLIB_PLUGINDIR=$TSLIB_ROOT/lib/ts\n")
            .append("export TSLIB_CALIBFILE=/etc/pointercal\n")
            .append("export TSLIB_CONSOLEDEVICE=none\n")
            .append("export TSLIB_FBDEVICE=/dev/fb0\n")
            .append("export TS_INFO_FILE=/sys/class/input/input0/uevent\n")
            .append("\n")
            .append("export LANG=\"zh\"_CN \n")
            .append("export QWS_KEYBOARD=TTY\n")
            .append("export QTDIR=/usr/qt\n")
            .append("export QPEDIR=/usr/qt\n")
            .append("export QWS_MOUSE_PROTO=Tslib:/dev/input/event0\n")
            .append("export QT_QWS_FONTDIR=$QTDIR/lib/fonts\n")
            .append("export QWS_DISPLAY=\"LinuxFb:/dev/fb0\"\n")
            .append("export QWS_SIZE=800x480\n")
            .append("export PATH=$QTDIR/bin:$PATH\n")
            .append("export LD_LIBRARY_PATH=lib:/usr/lib:$TSLIB_ROOT/lib:$QTDIR/lib:$LD_LIBRARY_PATH\n")
            .append("\n");

    autoRun.append("#autorun\n")
            .append("cd /home/util\n")
            .append("chmod 755 autorun.sh\n")
            .append("./autorun.sh &\n")
            .append("\n");
}


QString Profile::stdProfile()
{
    QString ret;
    ret.append(start).append(systemStr);
    if(isQt)
    {
        ret.append(qt);
    }
    if(isAutoRun)
    {
        ret.append(autoRun);
    }
    //ret.append(telnet);

    return ret;
}
